package org.hry.file.test;

import java.io.*;

public class IoCopy {
    public static void main(String[] args) throws Exception {
        Long start = System.currentTimeMillis();
        File source = new File("E:\\source.zip");
        File dest = new File("E:\\back.zip");
        try(InputStream in = new FileInputStream(source); OutputStream out = new FileOutputStream(dest)) {
            byte[] buffer = new byte[10240];
            int length;
            while ((length = in.read(buffer)) > 0) {
                out.write(buffer, 0, length);
            }
        }
        System.out.println("总共耗时：" + (System.currentTimeMillis() - start));
    }
}
